/**
 * @author lteng
 * @time 2022-06-16 22:22:29 
 */

package liteng.study.cn.stuscore.service.impl;

import java.util.List;

import liteng.study.cn.stuscore.comm.Page;
import liteng.study.cn.stuscore.dao.GradeDao;
import liteng.study.cn.stuscore.dao.impl.GradeDaoImpl;
import liteng.study.cn.stuscore.entity.Grade;
import liteng.study.cn.stuscore.service.GradeService;

/**
 * 年级信息业务层实现类
 */
public class GradeServiceImpl implements GradeService {
	GradeDao gradeDao = new GradeDaoImpl();

	@Override
	public void add(Grade grade) {
		// TODO Auto-generated method stub
		gradeDao.add(grade);
	}

	@Override
	public void update(Grade grade) {
		// TODO Auto-generated method stub
		gradeDao.update(grade);
	}

	@Override
	public void delete(Grade grade) {
		// TODO Auto-generated method stub
		gradeDao.delete(grade);

	}

	@Override
	public Grade getOne(int id) {
		// TODO Auto-generated method stub
		Grade grade = gradeDao.qryOne(id);
		return grade;
	}

	@Override
	public boolean isExistGrade(String name) {
		// TODO Auto-generated method stub
		Grade grade = gradeDao.qryGradeByName(name);
		return grade == null ? false : true;
	}

	@Override
	public Grade getGradeByName(String name) {
		// TODO Auto-generated method stub
		Grade grade = gradeDao.qryGradeByName(name);
		return grade;
	}

	@Override
	public Page getPageGrades(int padeIndex, int PageSize) {
		// TODO Auto-generated method stub
		Page page = gradeDao.qryGrades(padeIndex, PageSize);
		return page;
	}

	@Override
	public Page getPageGrades(int padeIndex, int PageSize, String name) {
		// TODO Auto-generated method stub
		Page page = gradeDao.qryGrades(padeIndex, PageSize, name);
		return page;
	}

	@Override
	public List<Grade> getGrades() {
		// TODO Auto-generated method stub
		List<Grade> grades = gradeDao.qryGrades();
		return grades.size() > 0 ? grades : null;
	}

}
